// 实体类,表结构 + 模型 用户表

let mongoose = require('mongoose')

// 定义用户表结构
let Schema = mongoose.Schema

let UserInfoSchema = new Schema({
    nickName: {
        type: String,
        default: 'admin'
    },
    email: {
        type: String,
        default: 'admin@qq.com'
    },
    password: {
        type: String,
        default: '123456'
    }
})


UserInfoSchema.statics = {
    // 保存
    save (opts) {
        return this.create(opts)
    }
}


module.exports = mongoose.model('UserInfo', UserInfoSchema)

